<?php

namespace app\sisome\controller;

use think\Request;

class Caiwu extends Common
{
    /**
     * @name 转账记录
     * @author zay
     * @Date 2020/4/3 0003 10:13
     * @return \think\response\View
     */
    public function index(Request $request)
    {
        $start = $request->param('start', 0);
        $end = $request->param('end', 0);
        $orderby = 'time';
        $ordersc = 'desc';
        $list = Db('digital_order');
        if ($start && $end) {
            $list->whereTime('time', '>=', $start);
            $list->whereTime('time', '<=', $end);
        }
        if (!empty($request->param('uname'))) {
            $list->where(['uid_uname' => $request->param('uname')]);
        }
        $list = $list->order([$orderby => $ordersc])->paginate(20, false, ['query' => Request::instance()->param()]);
        $this->assign('lists', $list);
        return view();
    }

    public function tgsy()
    {            //KM++推广收益明细
        $map = array();
        if (isset($_GET['uname'])) {
            $map['uname'] = $_GET['uname'];
        }
        $list = db('invite_reward_coin')->where($map)->order('ID DESC')->paginate(20);
        $this->assign('lists', $list); // 賦值數據集
        return view();
    }

    /**
     * @name 财务明细
     * @author zay
     * @Date 2020/4/3 0003 10:13
     * @return \think\response\View
     */
    public function detail(Request $request)
    {
        $uname = $request->param('uname', '');
        $list = Db('logocoin');
        if ($uname) {
            $list->where(['uname' => $uname]);
        }
        $list->whereIn('type', [1, 2, 3, 4, 5, 6, 9, 11, 12]);
        $list = $list->order('time desc')->paginate(20, false, ['query' => Request::instance()->param()]);
        $this->assign('lists', $list);
        return view();
    }
}
